UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O25qP5RV3DEtBioqqu3Rh/o6FkJdxITcAUc66Pgbmcc=' 
WHERE 
  key_id = '4486f1a6abae480e249d224ba511d7cda0afcab4d7ef157fc1eaa9bda6d63d22' 
  AND (
    token = 'O25qP5RV3DEtBioqqu3Rh/o6FkJdxITcAUc66Pgbmcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045