UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lyNkEaSHsHLin56HAJF9Tg/F5cqxN6/Fw+9OxCbT2uc=' 
WHERE 
  key_id = 'bec0ba8986bf9c75c520213e405aaec257bd1e73e075cd272a5c846b61be1e9c' 
  AND (
    token = 'lyNkEaSHsHLin56HAJF9Tg/F5cqxN6/Fw+9OxCbT2uc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036