UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '50TbRFXCacpY3OzD0ugPFzQS+P0CiFYU8G3bGzH506Q=' 
WHERE 
  key_id = 'c0a69795ef5df954acb0a1decf022bb7552310433dbd1212c18a502a8d85b06d' 
  AND (
    token = '50TbRFXCacpY3OzD0ugPFzQS+P0CiFYU8G3bGzH506Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046