UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vpQBjLyaXxL2Z5PP+y7IvnyojJQM46s8UBYADoWnLCg=' 
WHERE 
  key_id = '562f0b2f64beae231257f6b13dee8b34c876df427c03460c56c14860592af908' 
  AND (
    token = 'vpQBjLyaXxL2Z5PP+y7IvnyojJQM46s8UBYADoWnLCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056