UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0ZOPGC89ry56//XlFaCwi29HjzAbVCVlN3soopcmXtw=' 
WHERE 
  key_id = 'd191ca10e9391090292a3dbc70ea1e07fdc785f5a4a27d8cd1e2af4a240a3a60' 
  AND (
    token = '0ZOPGC89ry56//XlFaCwi29HjzAbVCVlN3soopcmXtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025