UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xriihB2AJsRhbwV9+6vl2DuJjFV1fsBBXI8EDGr160g=' 
WHERE 
  key_id = '2766e74571eed3658f413a3b4506ac9da987492cc98b5e6dec74906445c6c611' 
  AND (
    token = 'xriihB2AJsRhbwV9+6vl2DuJjFV1fsBBXI8EDGr160g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036