UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4zFOUxeRdizorwcKIZCP9aFe03Ye2BLMY/T7V6GkmbU=' 
WHERE 
  key_id = '1f3b0b22f9aacbeb8d29b8c1c816e171426ee005e9d5ebf4144868ec0065b758' 
  AND (
    token = '4zFOUxeRdizorwcKIZCP9aFe03Ye2BLMY/T7V6GkmbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032