UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+cPjtU2VnLh8XXo5ScUbBVFgjdAH/dlGpPI2vIfAyUQ=' 
WHERE 
  key_id = '0f4b6ff152577c0207ff85497fca7a26d5353598fc5c9abb575000a265d207a3' 
  AND (
    token = '+cPjtU2VnLh8XXo5ScUbBVFgjdAH/dlGpPI2vIfAyUQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035