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

Query time 0.00036