UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4l//cEtZwwDgBa34qj0FXTsfD/OSKg1r9MCjawLfjWM=' 
WHERE 
  key_id = 'c611e134b0446831d0c1fd88d18ee4c37a18611a79399f7b745bc2811c3ec504' 
  AND (
    token = '4l//cEtZwwDgBa34qj0FXTsfD/OSKg1r9MCjawLfjWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028