UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sNrvGTnvfxY0aL5ObVEU2tKOBYo7W1gYWqiKUtXXspw=' 
WHERE 
  key_id = '56f3308810a5cb6c00b5004e1de1c84862f8df620a22bb2d3e07864c8ef0823e' 
  AND (
    token = 'sNrvGTnvfxY0aL5ObVEU2tKOBYo7W1gYWqiKUtXXspw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032