UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gUTUwXxzhL1v5ryuOYFU2NDpqr+K48NF/9dGA9aJ03s=' 
WHERE 
  key_id = '9e0b320b279de351d83ea3ef798e41d0bcbdc6892ef4861673a6ca49a8722d9a' 
  AND (
    token = 'gUTUwXxzhL1v5ryuOYFU2NDpqr+K48NF/9dGA9aJ03s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036