UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oheLQ+mYscvQ0yJ2Oy0blUfgATl2HUww26vIHTF/QUw=' 
WHERE 
  key_id = '3c49a828c53a4c6d829f61e88105eaac4a9598af9a53225981be589cb58e9a12' 
  AND (
    token = 'oheLQ+mYscvQ0yJ2Oy0blUfgATl2HUww26vIHTF/QUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039