UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zc2mv1Jz0pk5zhgwOXqlTPA5VN5RUFRciet8hlhZAww=' 
WHERE 
  key_id = 'df554562bd619e343b329d9cf72667358a51708aa8fa97ed66940e92c460005f' 
  AND (
    token = 'zc2mv1Jz0pk5zhgwOXqlTPA5VN5RUFRciet8hlhZAww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051