UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4a8ALDlduoAve5nlvo4w486y8oCM4iZwL6e4f1YI/3Q=' 
WHERE 
  key_id = '03651d3456cae15a083d5c4f7d7d4ee5258942a687efd7e3029547807b165b6b' 
  AND (
    token = '4a8ALDlduoAve5nlvo4w486y8oCM4iZwL6e4f1YI/3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053