UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8CKGZRl6GpuJn7pu5fzO49F6/veDvGLZzxxx8M6ALKs=' 
WHERE 
  key_id = 'a8dfed691cd137cea1b38895c4f457461e08501df84cec007837be5bdf9d7be8' 
  AND (
    token = '8CKGZRl6GpuJn7pu5fzO49F6/veDvGLZzxxx8M6ALKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020