UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DGTLzwCSHaH9vy+vNf9d8sY9Lr85NVW32DxUkSm5yaA=' 
WHERE 
  key_id = 'c1ddd95b41bc3889ebbd9945f50571d3f7435d142953841017eaba7e59f392c6' 
  AND (
    token = 'DGTLzwCSHaH9vy+vNf9d8sY9Lr85NVW32DxUkSm5yaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035