UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ErG+WBjYpVFSDTR1czNtlRLjhHQugUEdzaqGledEKJg=' 
WHERE 
  key_id = '014a21ac2a60d5a7f68e3e4f45f64749e2f977edc468a15698ff889f02b8a05a' 
  AND (
    token = 'ErG+WBjYpVFSDTR1czNtlRLjhHQugUEdzaqGledEKJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046