UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '57Qgl4Xc4RF5yAmY42+Hm1FbnZc10pjX3GYjJIr7Ds0=' 
WHERE 
  key_id = '3d141ef0bbd1bc484629c464d32c822cbc8fce82824c403aaa116b9987e022b9' 
  AND (
    token = '57Qgl4Xc4RF5yAmY42+Hm1FbnZc10pjX3GYjJIr7Ds0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029