UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tRkc2T91C78y4TRyXOn6rtO7HyYuCnhUw3VT7dTvAVs=' 
WHERE 
  key_id = '00b30cd919fb2b01527609667c6fc3ea9e876b5b89c305ac7a9c4bb88f30e9c0' 
  AND (
    token = 'tRkc2T91C78y4TRyXOn6rtO7HyYuCnhUw3VT7dTvAVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042