UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jMqf+lxUhUO27Ayz4r85Bi7wxKtspSX5UaOYV+66DaE=' 
WHERE 
  key_id = '5395079cccb94ef6b8013c7e191220c58315483909195ff565b67a69fc851a6d' 
  AND (
    token = 'jMqf+lxUhUO27Ayz4r85Bi7wxKtspSX5UaOYV+66DaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037