UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HDCQua95btVvEbKwpZBvKH+q1U7KeMqkeJihpKGT7NI=' 
WHERE 
  key_id = '2ba8c3d638b2cd121eba7d1672c47af082fa14ec9982adc834e5430d48962676' 
  AND (
    token = 'HDCQua95btVvEbKwpZBvKH+q1U7KeMqkeJihpKGT7NI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018