UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tkTpsmJnpNGs65HGfQGyPFejenajf82r4uDvgB6je98=' 
WHERE 
  key_id = '5df4742b34f7474b3cb2b3fd87eaeb5ab5d9026b9ec74df26125f634696529db' 
  AND (
    token = 'tkTpsmJnpNGs65HGfQGyPFejenajf82r4uDvgB6je98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029