UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L5LHGd4xVEw3UBMSMtCegpcjpj+RD9QvL3Y8kYgRvZs=' 
WHERE 
  key_id = '421a911d198443907d98868cc6b15e0bcd9c4e5fa29b66df9025d19696a624a5' 
  AND (
    token = 'L5LHGd4xVEw3UBMSMtCegpcjpj+RD9QvL3Y8kYgRvZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031