UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zp84ex+l1rs0f7/0ltqaEK08yPyqxpiLG+d3OGMHdbQ=' 
WHERE 
  key_id = '83d8d21d41f916da6280a7a7e0123247740623bb0d6017758b66931237e15194' 
  AND (
    token = 'Zp84ex+l1rs0f7/0ltqaEK08yPyqxpiLG+d3OGMHdbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029